#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include <stdlib.h>
#include <string.h>
#include "aut.h"

void on_Directeur_clicked  (GtkWidget *objet_graphique,gpointer user_data)
{
GtkWidget *head_secu;
GtkWidget *log_mdp;

head_secu=lookup_widget(objet_graphique, "head_secu");
gtk_widget_hide(head_secu);

log_mdp = create_log_mdp ();
gtk_widget_show (log_mdp);
}


void on_quit1_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_head_secu_quit();
}


void on_ok1_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];
int test;
char chemin[] = "/home/hedi/Projects/project2/src/info_head.txt";
GtkWidget *login1;//saisie graphique du login
GtkWidget *mdp1;//saisie graphique du prenom

login1 = lookup_widget(objet_graphique, "login1");
mdp1 = lookup_widget(objet_graphique, "mdp1");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(login1)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(mdp1)));
test=verif_fheadmaster1(chemin,log,mdp);
if (test==1)
{
gtk_log_mdp_quit();
GtkWidget *pat_perso;
pat_perso = create_pat_perso ();
gtk_widget_show (pat_perso);
}}



void on_patient_clicked (GtkWidget *objet_graphique,gpointer user_data)
{//khalil work
}
void on_personnel_clicked(GtkWidget *objet_graphique,gpointer user_data)
{//asma work
}
void on_modif_head_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_pat_perso_quit();
GtkWidget *modifh;
modifh = create_modifh ();
gtk_widget_show (modifh);
}


void on_quit3_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_pat_perso_quit();
GtkWidget *head_secu;
head_secu = create_head_secu ();
gtk_widget_show (head_secu);
}

void on_security_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_head_secu_quit();
GtkWidget *log_mdp2;
log_mdp2 = create_log_mdp2 ();
gtk_widget_show (log_mdp2);}

void on_parcours_clicked (GtkWidget *objet_graphique,gpointer user_data)
{//hossem work
}
void on_capteur_clicked (GtkWidget *objet_graphique,gpointer user_data)
{//7ama+farouk work
}
void on_modif2_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_par_capt_quit();
GtkWidget *modifs;
modifs = create_modifs ();
gtk_widget_show (modifs);
}
void on_quit4_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_par_capt_quit();
GtkWidget *head_secu;
head_secu = create_head_secu ();
gtk_widget_show (head_secu);
}

void on_ok2_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];
int test;
char chemin[] = "/home/hedi/Projects/project2/src/info_security.txt";
GtkWidget *login2;//saisie graphique du login
GtkWidget *mdp2;//saisie graphique du prenom

login2 = lookup_widget(objet_graphique, "login2");
mdp2 = lookup_widget(objet_graphique, "mdp2");
//copie de login2 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(login2)));
///copie de mdp2 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(mdp2)));
test=verif_fsecurity1(chemin,log,mdp);
if (test==1)
{
gtk_log_mdp2_quit();
GtkWidget *par_capt;
par_capt = create_par_capt ();
gtk_widget_show (par_capt);
}}
void on_ok3_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];

char chemin[] = "/home/hedi/Projects/project2/src/info_head.txt";
GtkWidget *new_log0;//saisie graphique du login
GtkWidget *new_mdp0;//saisie graphique du prenom

new_log0 = lookup_widget(objet_graphique, "new_log0");
new_mdp0 = lookup_widget(objet_graphique, "new_mdp0");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(new_log0)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(new_mdp0)));
modif_fheadmaster0(chemin,log,mdp);
gtk_modifh_quit();
GtkWidget *pat_perso;
pat_perso = create_pat_perso ();
gtk_widget_show (pat_perso);
}
void on_ok4_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];

char chemin[] = "/home/hedi/Projects/project2/src/info_security.txt";
GtkWidget *new_log1;//saisie graphique du login
GtkWidget *new_mdp1;//saisie graphique du prenom

new_log1 = lookup_widget(objet_graphique, "new_log1");
new_mdp1 = lookup_widget(objet_graphique, "new_mdp1");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(new_log1)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(new_mdp1)));
modif_fsecurity0(chemin,log,mdp);
gtk_modifs_quit();
GtkWidget *pat_perso;
pat_perso = create_pat_perso ();
gtk_widget_show (pat_perso);
}




